document.querySelector("#btnId").onclick = () => {
    alert('这是id按钮')
}

document.querySelector(".btnClass").onclick = () => {
    alert('这是class按钮')
}

document.querySelector("button[a ='1']").onclick = () => {
    alert('这是a1按钮')
}

// document.querySelector("button[a ='2']").onclick = () => {
//     alert('这是a2按钮')
// }

// const = document.querySelector("button[a = '2']")